<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>申请提现</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
    <style>
        .content {
            margin: 0;
            padding: 0;
        }

        .main-box {
            display: -webkit-flex;
            display: flex;
            flex-direction: column;
            height: 7.5rem;
            background: rgba(255, 255, 255, 1);
            justify-content: center;
        }

        .tipText {
            font-size: 0.75rem;
            font-family: MicrosoftYaHei;
            color: rgba(51, 51, 51, 1);
            margin-left: 0.5rem;
        }

        .tipAmount {
            font-size: 1.3rem;
            font-family: MicrosoftYaHei-Bold;
            color: rgba(232, 57, 13, 1);
            margin-bottom: 0.8rem;
            margin-left: 0.5rem;
        }

        .inpuAmount {
            border-top: 0.05rem solid rgba(238, 238, 238, 1);
            display: -webkit-flex;
            display: flex;
            justify-content: space-between;
            text-align: center;
            height: 1.8rem;
            margin-left: 0.5rem;
        }

        .inpuAmount input[type=number] {
            height: 1.8rem;
            font-size: 0.8rem;
            font-family: MicrosoftYaHei;
            color: rgba(153, 153, 153, 1);
            border: 0;
            text-align: left;
            vertical-align: center;
        }
		.inpuAmount input[type=text] {
			height: 1.8rem;
			font-size: 0.8rem;
			font-family: MicrosoftYaHei;
			color: rgba(153, 153, 153, 1);
			border: 0;
			text-align: left;
			vertical-align: center;
		}

        .inpuAmount .unit {
            font-size: 0.9rem;
            font-family: MicrosoftYaHei;
            color: rgba(51, 51, 51, 1);
            margin-right: 0.5rem;
            text-align: center;
            line-height: 1.8rem;
        }
		.inpuAmount .name {
			font-size: 0.9rem;
			font-family: MicrosoftYaHei;
			color: rgba(51, 51, 51, 1);
			margin-right: 0.5rem;
			text-align: center;
			line-height: 1.8rem;
		}

        .target-box {
            height: 4.45rem;
            background: rgba(255, 255, 255, 1);
            line-height: 4.45rem;
            margin-top: 0.5rem;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
        }

        .withdrawTarget {
            height: 2.9rem;
            background: rgba(255, 147, 38, 1);
            font-size: 0.8rem;
            font-family: MicrosoftYaHei-Bold;
            color: rgba(255, 255, 255, 1);
            border-radius: 0rem;
            box-shadow: 0.2rem 0.2rem 0.2rem rgba(255, 184, 112, 0.5);
            vertical-align: center;
            line-height: 2.9rem;
        }

        .withdrawTarget img {
            width: 1rem;
            height: 1rem;
            margin-left: 1rem;
        }

        .withdrawTarget .target-name {
            margin-left: 0.5rem;
        }

        .withdrawBtn {
            margin-top: 1rem;
            display: -webkit-flex;
            display: flex;
            justify-content: center;
        }

        .btn {
            width: 15rem;
            height: 2rem;
            background-color: #FF9326;
            border-radius: 1rem 1rem 1rem 1rem;
            text-align: center;
            line-height: 2rem;
            color: rgba(255, 255, 255, 1);
        }
    </style>
</head>

<body>
    <!-- 你的html代码 -->
    <div class="page">
        <header class="bar bar-nav">
            <!--<a class="button button-link button-nav pull-left" data-transition='slide-out'>-->
                <!--<span class="icon icon-left"></span>-->
                <!--返回-->
            <!--</a>-->
            <h1 class="title">申请提现</h1>
            <a class="button button-link button-nav pull-right" data-transition='slide-out' href="./myWithdrawRecord.html">
                提现记录
            </a>
        </header>
        <nav class="bar bar-tab">
            <a class="tab-item" href="../index.html">
                <span class="icon icon-home"></span>
                <span class="tab-label">首页</span>
            </a>
            <a class="tab-item" href="../category.html">
                <span class="icon icon-menu"></span>
                <span class="tab-label">分类</span>
            </a>
            <a class="tab-item" href="../cart.html">
                <span class="icon icon-cart"></span>
                <span class="tab-label">购物车</span>
            </a>
            <a class="tab-item  active" href="../personal.html">
                <span class="icon icon-me"></span>
                <span class="tab-label">我的</span>
            </a>
        </nav>
        <!-- 这里是页面内容区 -->
        <div class="content">
            <div class="main-box">
                <div class="tipText">可提现佣金(分红)总额</div>
                <div class="tipAmount">￥47000.00</div>
                <div class="inpuAmount">
                    <input type="number" placeholder="请输入提现金额" id="withdraw-amount">
                    <span class="unit">元</span>
                </div>
				<div class="input-name inpuAmount">
					<input type="text" placeholder="请输入微信实名认证姓名" id="real-name">
					<span class="name">真实姓名</span>
				</div>
            </div>
            <div class="target-box">
                <div class="withdrawTarget">
                    <div class="target-icon">
                        <img src="../image/wechat-icon.png" />
                        <span class="target-name">提现到微信钱包</span>
                    </div>
                </div>
            </div>
            <div class="withdrawBtn">
                <span class="btn" onclick="applyWithdraw();">立即提现</span>
            </div>
        </div>
        <script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
        <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
        <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
        <script type='text/javascript' src='../js/index.js' charset='utf-8'></script>
</body>
<script>
	var showAmount;
	$(function(){
		showAmount = location.search.split("=")[1];
		$(".main-box .tipAmount").text("￥"+showAmount);
	})
    /**
     * 申请提现
     */
    function applyWithdraw() {
        var withdrawAmount = $("#withdraw-amount").val();
		var realName = $("#real-name").val();
        if (withdrawAmount == null || withdrawAmount == '' || withdrawAmount == 0) {
            $.alert('请输入有效金额');
            return;
        }
		if (realName == null || realName == '' || realName == 0) {
			$.alert('请输入真实姓名');
			return;
		}
		withdrawAmount = parseFloat(withdrawAmount);
		showAmount = parseFloat(showAmount);
		if(withdrawAmount > showAmount){
			$.alert("提现金额不能大于可提现金额");
		}
		
		$.post(prefix+"/walletInfo/api/withdraw",{"realName":realName,"withdrawAmount":withdrawAmount},function(data){
			$.alert(data.msg);
			if(data.code == 0){
				window.location.href="applyWithdraw.html?q="+showAmount-withdrawAmount;
			}
		});
		
    }
</script>

</html>
